#!/bin/python3
import os
val = os.system('sudo mkdir -p /etc/systemd/system/docker.service.d ')
val = os.system('sudo touch /etc/systemd/system/docker.service.d/proxy.conf')
val = os.system('sudo chmod 777 /etc/systemd/system/docker.service.d/proxy.conf')
val = os.system('sudo echo '
[Service]
Environment="HTTP_PROXY=http://proxy.xxx.com:8888/" 
Environment="HTTPS_PROXY=http://proxy.xxx.com:8888/"
' >> /etc/systemd/system/docker.service.d/proxy.conf ')

val = os.system('sudo systemctl daemon-reload')
val = os.system('sudo systemctl restart docker')
val = os.system('echo 'sudo systemctl show --property=Environment docker#查看结果' ')